package com.edisoncgh.controller;

        import com.edisoncgh.pojo.View;
        import com.edisoncgh.service.ViewService;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.beans.factory.annotation.Qualifier;
        import org.springframework.stereotype.Controller;
        import org.springframework.ui.Model;
        import org.springframework.web.bind.annotation.RequestMapping;

        import java.util.List;

@Controller
@RequestMapping("/view")
public class ViewController {
    // controller调service层
    @Autowired
    @Qualifier("ViewServiceImpl")
    private ViewService viewService;

    // 查询全部书籍，返回一个书籍展示页面
    @RequestMapping("/allRecord")
    public String list(Model model) {
        List<View> list = viewService.findAll();
        model.addAttribute("list", list);
        return "allRecord";
    }

    @RequestMapping("/allRecordByClassNo")
    public String list2(String classNo, Model model) {
        List<View> list = viewService.findByClassNo(classNo);
        model.addAttribute("list", list);
        return "allRecord";
    }

    @RequestMapping("/allRecordByBookClassNo")
    public String list3(String classNo, Model model) {
        List<View> list = viewService.findByBookClassNo(classNo);
        model.addAttribute("list", list);
        return "allRecord";
    }
}
